import { http } from "@/utils/http.js";

// 我的客户数据
export const productdetails = (data) => {
  return http.request({
    method: "get",
    url: `/product/details/${data.id}`,
    params: {
      // ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 我的客户数据
export const recommend = (data) => {
  return http.request({
    method: "get",
    url: `/product/recommend`,
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 我的客户数据
export const productqrcode = (data) => {
  return http.request({
    method: "get",
    url: `/product/qrcode`,
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 商品分类
export const appCategory = (data) => {
  return http.request({
    method: "get",
    url: `/app/category`,
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// app / unit;

// 商品单位
export const appUnit = (data) => {
  return http.request({
    method: "get",
    url: `/app/unit`,
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 商品分类
export const appProductQuery = (data) => {
  return http.request({
    method: "get",
    url: `/app/product/query`,
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 供应商
export const supplierSelector = (data) => {
  return http.request({
    method: "get",
    url: `/app/supplier/selector`,
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//商品添加

export const productCreate = (data) => {
  return http.request({
    method: "post",
    url: "/app/product/create",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//商品详情

export const appProductDetail = (data) => {
  return http.request({
    method: "get",
    url: `/app/product/detail`,
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//商品禁用
export const appProductDisable = (data) => {
  return http.request({
    method: "post",
    url: "/app/product/disable",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};
//商品启用
export const appProductEnable = (data) => {
  return http.request({
    method: "post",
    url: "/app/product/enable",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//商品编辑

export const productUpdate = (data) => {
  return http.request({
    method: "post",
    url: "/app/product/update",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};
//生成条形码

export const appProductCode = (data) => {
  return http.request({
    method: "get",
    url: `/app/product/code`,
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//商品改价

export const salePriceCreate = (data) => {
  return http.request({
    method: "post",
    // header: { "content-type": "application/x-www-form-urlencoded" },
    url: "/app/salePrice/create",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//商品改价查询

export const salePriceQuery = (data) => {
  return http.request({
    method: "get",
    url: `/app/salePrice/query`,
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//商品改价

export const saleShopPriceCreate = (data) => {
  return http.request({
    method: "post",
    // header: { "content-type": "application/x-www-form-urlencoded" },
    url: "/app/salePrice/shop/create",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};
//商品改价查询

export const saleShopPriceQuery = (data) => {
  return http.request({
    method: "get",
    url: `/app/salePrice/shop/query`,
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//商品改价查询

export const queryOfferPrices = (data) => {
  return http.request({
    method: "get",
    url: `/app/product/queryOfferPrices`,

    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//商品改价查询

export const brand = (data) => {
  return http.request({
    method: "get",
    url: `/app/brand`,

    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//产库数量分类统计

export const categoryCount = (data) => {
  return http.request({
    method: "get",
    url: `/app/category/categoryCount`,

    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};
